package cn.zhuizikejithreeig.com.passenger;
import android.app.Application;
import android.bluetooth.BluetoothSocket;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.zhy.http.okhttp.OkHttpUtils;
import java.util.concurrent.TimeUnit;
import cn.zhuizikejithreeig.com.utils.CrashHandler;
import okhttp3.OkHttpClient;

/**
 * Created by 赵航 on 2018/3/9 0009.
 */

public class CompontApplayCation extends Application {
    public static Context      context;
    public static Handler      mainHandler;
    public static BluetoothSocket bluetoothSocket;

    //此ID为官方提供的App_ID
    private static final String APP_ID = "wxff391d4054eaf2c1";
    //此为App与微信的调用接口
    public static IWXAPI iwxapi;
    @Override
    public void onCreate() {
        super.onCreate();
        //开启服务

        context = this;
        mainHandler = new Handler(Looper.getMainLooper());

        //网络请求框架
        OkHttpClient okHttpClient = new OkHttpClient.Builder()
                //                .addInterceptor(new LoggerInterceptor("TAG"))
                .connectTimeout(10000L, TimeUnit.MILLISECONDS)
                .readTimeout(10000L, TimeUnit.MILLISECONDS)
                //其他配置
                .build();
        OkHttpUtils.initClient(okHttpClient);


        //获取全局未捕获的异常
        CrashHandler crashHandler = CrashHandler.getInstance();
        crashHandler.init(getApplicationContext());

        //获取接口实例
        iwxapi = WXAPIFactory.createWXAPI(this, APP_ID, true);
        //注册到app
        iwxapi.registerApp(APP_ID);

    }
}